package com.freewater.parking.domain.parking;

import com.freewater.parking.domain.common.Nullable;
import com.freewater.parking.domain.common.PlateNumber;
import org.apache.commons.lang3.Validate;

import java.time.LocalDateTime;

public class FeeCalcSpecification {
    private final PlateNumber plateNumber;
    private final LocalDateTime checkInTime;
    private final LocalDateTime checkOutTime;
    private final LocalDateTime payTime;

    public FeeCalcSpecification(PlateNumber plateNumber,
                                LocalDateTime checkInTime,
                                LocalDateTime checkOutTime,
                                @Nullable LocalDateTime payTime) {
        Validate.isTrue(plateNumber != null, "车牌号不能为空");
        Validate.isTrue(checkInTime != null, "入场时间不能为空");
        Validate.isTrue(checkOutTime != null, "出场时间不能为空");
        Validate.isTrue(checkOutTime.isAfter(checkInTime), "出场时间不能小于入场时间");
        this.plateNumber = plateNumber;
        this.checkInTime = checkInTime;
        this.checkOutTime = checkOutTime;
        this.payTime = payTime;
    }

    public PlateNumber getPlateNumber() {
        return plateNumber;
    }

    public LocalDateTime getCheckInTime() {
        return checkInTime;
    }

    public LocalDateTime getCheckOutTime() {
        return checkOutTime;
    }

    public LocalDateTime getPayTime() {
        return payTime;
    }
}
